home *** CD-ROM | disk | FTP | other *** search
- // File testset.cpp
- // Demo for class set
-
- #include <conio.h>
- #include "ooset.h"
-
- void main( void )
- {
- clrscr();
-
- cout << "Sets have range from " << MINIMUM << " to " << MAXIMUM << "\n";
-
- set a; // { NULL }
- cout << "\na () = " << a;
- getch();
-
- set j = -a; // { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }
- cout << "j = (-a) = " << j;
- getch();
-
- set m = 10 + 12 + 14 + 15 + 19;
- cout << "\nm = (10 + 12 + 14 + 15 + 19) = " << m;
- getch();
-
- set b = 12; // { 12 }
- cout << "\nb = ( 12 ) = " << b;
- getch();
-
- set c = 15; // { 15 }
- cout << "c = ( 15 ) = " << c;
- getch();
-
- set g = b + c; // { 12, 15 }
- cout << "g = ( b + c ) = " << g;
- getch();
-
- set h = -g; // { 10, 11, 13, 14, 16, 17, 18, 19, 20 }
- cout << "\nh = ( -g ) = " << h;
- getch();
-
- cout << "\nj = " << j;
- cout << "g = " << g;
- set diff = j - g; // { 12, 15 }
- cout << "diff = ( j - g ) = " << diff;
- getch();
-
- cout << "\nj = " << j; // { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }
- cout << "h = " << h; // { 10, 11, 13, 14, 16, 17, 18, 19, 20 }
- set onion = j * h; // { 10, 11, 13, 14, 16, 17, 18, 19, 20 }
- cout << "union = ( j * h ) = " << onion;
- getch();
-
- cout << "\ng = " << g;
- cout << "h = " << h;
- set empty = g * h;
- cout << "empty = ( g * h ) = " << empty;
- getch();
-
- cout << "\nb= " << b;
- cout << "c = " << c;
- b += c;
- cout << "b += c = " << b;
- getch();
-
- set d = 13; // { 13 }
- cout << "\nd = ( 13 ) = " << d;
- getch();
-
- set e = 20; // { 20 }
- cout << "e = ( 20 ) = " << e;
- getch();
-
- set f = 10; // { 10 }
- cout << "f = ( 10 ) = " << f;
- getch();
-
- set z = b + c + d + e + f; // { 10, 12, 13, 15, 20 }
- cout << "\nz = ( b + c + d + e + f ) = " << z;
- set zz = b + d; // { 12, 13, 15 }
- cout << "zz = ( b+d ) = " << zz;
- set zzz = z - zz; // { 10, 20 }
- cout << "zzz = ( z - zz ) = " << zzz;
- getch();
-
- set x = z; // { 10, 12, 13, 15, 20 }
- cout << "\nx = z = " << x;
- set xx = zz; // { 12, 13, 15 }
- cout << "xx = zz = " << xx;
- x -= xx; // { 10, 20 }
- cout << "x -= xx = " << x;
- getch();
-
- cout << "\nh = " << h; // { 10, 11, 13, 14, 16, 17, 18, 19, 20 }
- cout << "z = " << z; // { 10, 12, 13, 15, 20 }
- h *= z; // { 10, 13, 20 }
- cout << "h *= z = " << h;
- getch();
-
- cout << "\nTRUE = 1, FALSE = 0\n";
-
- cout << "\nz = " << z; // { 10, 12, 13, 15, 20 }
- cout << "x = " << x; // { 10, 20 }
- cout << "z == x = " << ( z == x ) << "\n";
- getch();
-
- cout << "\nz = " << z; // { 10, 12, 13, 15, 20 }
- cout << "h = " << h; // { 10, 13, 20 }
- cout << "z == h = " << ( z == h );
- cout << "\nz == z = " << ( z == z ) << "\n";
- getch();
-
- cout << "\nz = " << z; // { 10, 12, 13, 15, 20 }
- cout << "x = " << x; // { 10, 20 }
- cout << "z != x = " << ( z != x );
- cout << "\nz != z = " << ( z != z ) << "\n";
- getch();
-
- cout << "\nz = " << z; // { 10, 12, 13, 15, 20 }
- cout << "h = " << h; // { 10, 13, 20 }
- cout << "z != h = " << ( z != h );
- cout << "\nz != z = " << ( z != z );
- cout << "\nz < h = " << ( z < h );
- cout << "\nh < z = " << ( h < z );
- cout << "\nz > h = " << ( z > h );
- cout << "\nh > z = " << ( h > z ) << "\n";
- getch();
-
- set dd = 11;
- dd += 14;
- dd += 17;
- cout << "\ndd = " << dd; // { 11, 14, 17 }
- cout << "h = " << h; // { 10, 13, 20 }
- cout << "h > dd = " << ( h > dd );
- cout << "\nh < dd = " << ( h < dd );
- cout << "\nh == dd = " << ( h == dd );
- cout << "\nh != dd = " << ( h != dd );
- cout << "\nh * dd = " << ( h * dd );
- getch();
-
- cout << "\nz = " << z; // { 10, 12, 13, 15, 20 }
- cout << "h = " << h; // { 10, 13, 20 }
- cout << "h >= z = " << ( h >= z );
- cout << "\nz >= h = " << ( z >= h );
- cout << "\nz >= z = " << ( z >= z ) << "\n";
- getch();
-
- cout << "\nz = " << z; // { 10, 12, 13, 15, 20 }
- cout << "h = " << h; // { 10, 13, 20 }
- cout << "h <= z = " << ( h <= z );
- cout << "\nz <= h = " << ( z <= h );
- cout << "\nz <= z = " << ( z <= z ) << "\n";
- getch();
-
- }